-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Relay nick changes feature #72
Conversation
4699cdc
to
33c0f7a
Compare
Worked through it and made some fixes, now works properly. This also includes a fix to puppet detection support. Didn't realize it before but we were clearing out the builtin callbacks for NICK which destroyed nick tracking! This would effect anything depending on |
880de7d
to
d6ddb0f
Compare
34a275b
to
485c29f
Compare
Would this be indicative of a need for a mutex around |
Since ignores were merged, I'm going to need to rebase this to master (try to preserve most commits that were not specifically mine only), and merge in PR #85 since that would make this a complete feature based on the current codebase, instead of the historical one wherein I wasn't certain which things might be merged. Hold tight on this PR for a bit, I'll pop a note and hit a "ready for review" button after I've updated this appropriately. I cannot fix the possible race condition however until qaisjp/go-ircevent #2 is resolved. There will remain a kludge to support extra channel status modes until qaisjp/go-ircevent #1 is resolved as well. After merging #85 into this PR I'd suggest that this would be ready for merging and that later on the kludge for channel status modes could be removed at a later date. I would also say merging this despite the race condition is fine so long as we note that there is a possible race condition in code external to this repository and that we'll resolve the issue when it is resolved in the external code. |
485c29f
to
dfffce1
Compare
With the prior commit this is now ready for review, as per the prior comment. |
db78d24
to
817adc3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't use this feature, so I'm trusting that you've tested it well & that it works! Is this ready to merge?
Yep, piggybacking is cool. Instead of |
Unless the merge of wim's discord would effect this it should work, if wanted can hold off for me to recreate my dev branch and merge in all the other branches and re-test (so many options got renamed, and have held off for a moment trying not to merge stuff together and have to do it again too soon lol). Do also note the above crash note which I believe is caused by go-ircevent (and go-discord-irc). I think that Also note there is a kludgy fix here for detecting extra modes
When #76 is merged, I believe "show_joinquit" should get removed in a separate PR (have to change the conditions for enabling/disabling those callbacks). |
I've merged master, so you should be able to pull and test :D
Yeah, I think adding a mutex will work. Feel free to submit a PR to the fork!
And we can fix that in the fork too?
Coolio 👍 |
I'll look into it. For the Mutex situation I think it'd be better to make Did test tonight, and for some reason seems my kludge isn't working for |
Ok, this works, kludge won't work as intended. The kludge will be ok to be left in even when go-ircevent is fixed (though it should definitely be removed after). In irc_nicktrack.go this is where the issue that makes it impossible for the kludge to even work properly is. It does not see the ~nick change to something else because the key is I'd say add this and make a note that it works but the messages for nick changes drop when the user is In the external nick tracking code this is completely an issue with handling All this to say - This is ready to be merged and should work correctly when go-ircevent is fixed and already works correctly for IRC Networks without special prefix mode. |
If qaisjp/go-ircevent #3 gets merged before this this PR will need to be updated. |
bridge/irc_listener.go
Outdated
i.ClearCallback("NICK") | ||
i.AddCallback("NICK", i.nickTrackNick) | ||
|
||
if i.relayNickTrackID != 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of a separate field for this, I think we could move
go-discord-irc/bridge/irc_listener.go
Lines 83 to 86 in f7f3a48
if !i.bridge.Config.ShowJoinQuit { | |
for event, id := range i.joinQuitCallbacks { | |
i.RemoveCallback(event, id) // note that QUIT was already removed above | |
} |
joinQuitCallbacks
to something else
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check the changes, I think the most recent commit does what you're looking for.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The other reason to leave in a nickTrackQuit
and nickTrackNick
vs merging them with other functions is to insure that we never could ever have event callback id 0. Worst case scenario the aforementioned ones would have that id, not the ones that are being removed/added in.
a42471b
to
c3d10e3
Compare
This is ready for merge. From a logical standpoint go-discord-irc is sound. The issue is the underlying IRC library and I don't think it makes sense to hold up waiting on that to be fixed. The IRC library does not provide for a way to have a set of callbacks that must complete execution before other callbacks. I need to think on this some more but there are a number of ways to solve this in my opinion.
I plan to go for option 2 but this shouldn't be held back by underlying library issues. Everything needing to basically wait on state tracking to complete can be changed later to listen for new events that signify exactly the same as current, except that tracking has fully completed and it is safe to assume the same as currently assumed. I'd probably even extend certain events to have a list of channels instead of just figuring it out from the callbacks that respond to the event. |
b86ab58
to
0be390b
Compare
bridge/irc_listener.go
Outdated
|
||
msg := IRCMessage{ | ||
Username: "", | ||
Message: fmt.Sprintf("_%s changed nick to %s_", oldNick, newNick), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is gonna be configurable in #76 right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is, I'm not too attached to the current format being a default either. Was more what is actually used, up till I started working on formatting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought I added "their" in, before, but I apparently undid that somewhere... will refix that.
3256ccb
to
afb3827
Compare
Tested, NICK/PART/KICK/JOIN works, QUIT doesn't until the silly logic error I made is fixed in go-ircevent (PR already submitted). |
@qaisjp Is varys finished? Is it able to call back into the main program (for example, on quit, it auto-reconnects IIRC and it will need to get it's irc_listener_prejoin_commands settings) so either it has them or it has to call back to the server and ask for them? Should I start looking at redoing this of sorts to work with varys? Edit: Edit 2: |
Not really. The default implementation is in-process, and seems to work. The networked implementation is unimplemented.
Good point. That will be an issue we need to solve! (Right now this situation is impossible, as everything is in-process.) |
NOTE: |
I'm going to rework this PR. There's some things that could be split out (fixes to use ST* events, etc) and then this will need a major rework and checkup for the Varys changes. Would you like to keep this PR open and the rework of this (minus the split out fixes or features) be here? or would you rather close this one and have a different PR come about when I've got the feature back into a working state? |
e1d0018
to
75c243f
Compare
This has been reworked, and is untested, depends on #95. EDIT: |
0191c93
to
a970126
Compare
Merge conflict :) |
Allows for nick changes in IRC to be shown in Discord
a970126
to
a9d896a
Compare
Fixed. I'll have to do this again for the formatting related one after this merges so holding off on fixing that over there till after this one merges. |
This relies on #69
It allows Nick changes in IRC to be shown in Discord. This can be a source of annoyance but some people do want to see that level of info in Discord. This level of info also would be helpful in the future when I add a way for Discord to ignore IRC nicks (can see join/quit/part/nick change and build up a proper hostmask for addition to the config).
Right now this piggybacks on the
show_joinquit
feature and config setting. I think we may want to either rename that config variable to something along the lines ofshow_metainfo
or make the relayed stuff fully configurable likeThat said if the latter is preferred I'd think using the
show_metainfo
idea as a stop-gap until the latter is implemented a good idea. I'm not sure if it is worth the trouble to implement it that granularly.